package com.ylkj.wx.controller;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.ylkj.member.service.ImRecordService;
import com.ylkj.wx.dto.QuestionListDTO;
import com.ylkj.wx.service.QuestionInfoTableService;

@Controller
@RequestMapping("/question")
public class QuestionListController {
    private static final Logger logger = LoggerFactory.getLogger(QuestionListController.class);
    
    @Autowired
	private QuestionInfoTableService questionInfoTableService;
    
    @RequestMapping("/questionList")  
    public ModelAndView questionList(HttpServletRequest request, HttpServletResponse response) {  
    	List<QuestionListDTO> questionList = questionInfoTableService.findQuestionInfoTable(0, 15);
    	return new ModelAndView("questionList", "questionList", questionList); 
    }  
    
    @RequestMapping("/questionDetail")  
    public ModelAndView questionDetail(HttpServletRequest request, HttpServletResponse response) {
    	String queId = request.getParameter("queId");
    	List<QuestionListDTO> answerList = questionInfoTableService.findAnswerInfoByQueId(Integer.valueOf(queId));
    	return new ModelAndView("answerList", "answerList", answerList); 
    }
}
